package semiProject_army.mvc.beans;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;

import semiProject_army.mvc.connection.ConnectionProvider;
import semiProject_army.mvc.connection.JDBCManager;

public class BoardDAO {	
	
	private Connection conn = null;
	private PreparedStatement pstmt = null;
	private ResultSet rs = null;

	private static BoardDAO instance = new BoardDAO();	
	
	public static BoardDAO getInstance() {
		return instance;
	};	
	
	private BoardDAO() { }
	

/*	public ArrayList<BookBean> getBest() {
		String bestsellerSql = "SELECT * FROM book order by bookCnt DESC limit 0, 4";
		ArrayList<BookBean> bookList = null;
		
		try{
			conn = ConnectionProvider.getConnection();
			pstmt = conn.prepareStatement(bestsellerSql);
			
			rs = pstmt.executeQuery();
			
			if(rs.next()) {
				
				bookList = new ArrayList<BookBean>();
				
				do {
					BookBean book = new BookBean();
					
					book.setBookName(rs.getString("bookName"));
					book.setBookImg(rs.getString("bookImg"));
					
					bookList.add(book);
					
				} while(rs.next());
			}
			
		} catch(Exception e) {
			System.out.println("BoardDao - getBest()");
			e.printStackTrace();
			
		} finally {
			JDBCManager.close(rs, pstmt, conn);
		}
		
		return bookList;
	}*/

}
